//
//  MerchantsRegisterViewController.m
//  NordsonTesco
//
//  Created by CccDaxIN on 16/7/5.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "MerchantsRegisterViewController.h"
#import "MerchantsViewCell.h"
#define left 135
@interface MerchantsRegisterViewController ()<UITextFieldDelegate>
{
    UISegmentedControl *registerSegmentControl;
    UITableView *registerTableView;
    UIView *footTabView;
    UITextField *field_yanzhengma;
    NSArray *field_array;
    UIButton *passwordButton;//密码
    UIButton *confirmPasswordButton;//确认密码
}
@property (nonatomic,strong)NSString *hideStringOne;
@property (nonatomic,strong)NSString *hideStringTwo;
@property (nonatomic,strong)UITextField *email_field;
@property (nonatomic,strong)UITextField *password_field;
@property (nonatomic,strong)UITextField *confirmPassword_field;
@property (nonatomic,strong)UITextField *shopName_field;
@property (nonatomic,strong)UITextField *userName_field;
@property (nonatomic,strong)UITextField *userPhone_field;

@end

@implementation MerchantsRegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self merchantsRegisterSwitch];
    
    UIButton *merchantsRegisterBackButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [merchantsRegisterBackButton addTarget:self action:@selector(merchantsRegisterBackButtonAction) forControlEvents:UIControlEventTouchUpInside];
    CGSize merchantsRegisterBackButtonSize = CGSizeMake(15, 30);
    merchantsRegisterBackButton.frame = CGRectMake(merchantsRegisterBackButton.frame.origin.x, merchantsRegisterBackButton.frame.origin.y, merchantsRegisterBackButtonSize.width, merchantsRegisterBackButtonSize.height);
    merchantsRegisterBackButton.titleLabel.font = [UIFont boldSystemFontOfSize:12];
    [merchantsRegisterBackButton setImage:[UIImage imageNamed:@"arrow---left"] forState:UIControlStateNormal];
    UIBarButtonItem *leftButtonItem = [[UIBarButtonItem alloc] initWithCustomView:merchantsRegisterBackButton];
    self.navigationItem.leftBarButtonItem = leftButtonItem;
    
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
    // Do any additional setup after loading the view.
}
- (void)merchantsRegisterBackButtonAction{
    [self.navigationController popViewControllerAnimated:YES];
}


-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    //       [[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}


- (void)keyboardWillShow:(NSNotification *)notification {
    
    /*
     Reduce the size of the text view so that it's not obscured by the keyboard.
     Animate the resize so that it's in sync with the appearance of the keyboard.
     */
    NSDictionary *userInfo = [notification userInfo];
    
    // Get the origin of the keyboard when it's displayed.
    NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
    // Get the top of the keyboard as the y coordinate of its origin in self's view's coordinate system. The bottom of the text view's frame should align with the top of the keyboard's final position.
    CGRect keyboardRect = [aValue CGRectValue];
    keyboardRect = [self.view convertRect:keyboardRect fromView:nil];
    
    CGFloat keyboardTop = keyboardRect.origin.y;
    CGRect newTextViewFrame = self.view.bounds;
    newTextViewFrame.size.height = keyboardTop - self.view.bounds.origin.y;
    
    // Get the duration of the animation.
    NSValue *animationDurationValue = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
    NSTimeInterval animationDuration;
    [animationDurationValue getValue:&animationDuration];
    
    // Animate the resize of the text view's frame in sync with the keyboard's appearance.
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:animationDuration];
    
    registerSegmentControl.frame = CGRectMake(20, 80, kScrernWidth-40, 35);
    registerTableView.frame = CGRectMake(0,115, kScrernWidth,keyboardTop - 115);
    [UIView commitAnimations];
}
- (void)keyboardWillHide:(NSNotification *)notification {
    
    NSDictionary* userInfo = [notification userInfo];
    
    /*
     Restore the size of the text view (fill self's view).
     Animate the resize so that it's in sync with the disappearance of the keyboard.
     */
    NSValue *animationDurationValue = [userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey];
    NSTimeInterval animationDuration;
    [animationDurationValue getValue:&animationDuration];
    
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:animationDuration];
    registerSegmentControl.frame = CGRectMake(20, 80, kScrernWidth-40, 35);
    registerTableView.frame = CGRectMake(0,115, kScrernWidth,kScrernHeight-115);
    [UIView commitAnimations];
}

#pragma mark -- 手机邮箱注册切换
- (void)merchantsRegisterSwitch{
    NSArray *array=@[@"手机注册",@"邮箱注册"];
    registerSegmentControl=[[UISegmentedControl alloc]initWithItems:array];
    registerSegmentControl.frame=CGRectMake(20,80,kScrernWidth-40, 35);
    registerSegmentControl.selectedSegmentIndex = 0;
    registerSegmentControl.tintColor=[UIColor colorWithRed:0.97 green:0.54 blue:0.36 alpha:1.00];
    [registerSegmentControl addTarget:self action:@selector(changeSegment:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:registerSegmentControl];
}
- (void)changeSegment:(UISegmentedControl *)segment{
    NSLog(@"segmentControl %ld",(long)registerSegmentControl.selectedSegmentIndex);
    if (registerSegmentControl.selectedSegmentIndex == 0) {
        [self createmerchantsRegisterTableView];
    }else if (registerSegmentControl.selectedSegmentIndex == 1){
        [self createmerchantsRegisterTableView];
    }
}

#pragma mark --  创建tableview
- (void)createmerchantsRegisterTableView{
    registerTableView =[[UITableView alloc]initWithFrame:CGRectMake(0,115, kScrernWidth,kScrernHeight-115) style:UITableViewStylePlain];
    registerTableView.delegate=self;
    registerTableView.dataSource=self;
//    [registerTableView setSeparatorColor:[UIColor whiteColor ]];
    //    storeEntranceTableView.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
    [registerTableView registerNib:[UINib nibWithNibName:@"MerchantsViewCell" bundle:nil] forCellReuseIdentifier:@"MerchantsViewCell"];

    [self.view addSubview:registerTableView];
    footTabView = [[UIView alloc]init];
    footTabView.frame = CGRectMake(0, 0, kScrernWidth, 150);
        UIButton *register_button = [UIButton buttonWithType:UIButtonTypeCustom];
        [register_button addTarget:self action:@selector(registerButtonkAction) forControlEvents:UIControlEventTouchUpInside];
        [register_button setTitle:@"注册" forState:UIControlStateNormal];
        register_button.layer.masksToBounds = YES;
        register_button.layer.cornerRadius = 5;
        register_button.frame = CGRectMake(10,25,kScrernWidth-20,35);//60
        register_button.backgroundColor = [UIColor colorWithRed:0.98 green:0.32 blue:0.12 alpha:1.00];
        [footTabView addSubview:register_button];
   
        UIButton *agreement_button = [UIButton buttonWithType:UIButtonTypeCustom];
        [agreement_button addTarget:self action:@selector(registerButtonkAction) forControlEvents:UIControlEventTouchUpInside];
        agreement_button.titleLabel.textAlignment = NSTextAlignmentCenter;
        agreement_button.titleLabel.font = [UIFont systemFontOfSize:14];
        [agreement_button setTitle:@"“注册” 即接受《益购使用协议》" forState:UIControlStateNormal];
        agreement_button.frame = CGRectMake(registerTableView.center.x - 90 ,CGRectGetMaxY(register_button.frame),200,30);
        [agreement_button setTitleColor:[UIColor colorWithRed:0.98 green:0.32 blue:0.12 alpha:1.00] forState:UIControlStateNormal];
        [footTabView addSubview:agreement_button];
        
        UILabel *signIn_label = [[UILabel alloc]initWithFrame:CGRectMake(agreement_button.center.x - 75,CGRectGetMaxY(agreement_button.frame), 120, 30)];
        signIn_label.font = [UIFont systemFontOfSize:14];
        signIn_label.textColor = [UIColor colorWithRed:0.68 green:0.68 blue:0.68 alpha:1.00];
        signIn_label.text = @"已注册过益购?点击";
        [footTabView addSubview:signIn_label];
        
        UIButton *signIn_button = [UIButton buttonWithType:UIButtonTypeCustom];
        [signIn_button addTarget:self action:@selector(signInButtonkAction) forControlEvents:UIControlEventTouchUpInside];
        signIn_button.titleLabel.font = [UIFont systemFontOfSize:14];
        [signIn_button setTitle:@"登录" forState:UIControlStateNormal];
        signIn_button.frame = CGRectMake(agreement_button.center.x + 45 ,CGRectGetMaxY(agreement_button.frame),40,30);
        [signIn_button setTitleColor:[UIColor colorWithRed:0.98 green:0.32 blue:0.12 alpha:1.00] forState:UIControlStateNormal];
        [footTabView addSubview:signIn_button];
    if (registerSegmentControl.selectedSegmentIndex == 0) {
        registerTableView.tableFooterView = footTabView;
    }else{
        registerTableView.tableFooterView = [[UIView alloc]init];

    }

}
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField resignFirstResponder];
    return YES;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 10;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 70;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (registerSegmentControl.selectedSegmentIndex == 0) {
        MerchantsViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"MerchantsViewCell" forIndexPath:indexPath];
        UIView *registerView = [[UIView alloc]initWithFrame:CGRectMake(10,69, kScrernWidth-10, 1)];
        registerView.backgroundColor = [UIColor colorWithRed:0.89 green:0.89 blue:0.89 alpha:1.00];
        [cell.contentView addSubview:registerView];
     
        NSArray *array_phone = @[@"手机号:",@"密码:",@"确认密码:",@"商铺身份:",@"名称:",@"联系人:",@"联系电话",@"验证码:",@" 服务人员姓名:",@" 服务人员电话:"];
        NSArray *phone_array = @[@"请输入手机号",@"请输入6-20位字符",@"请输入6-20位字符",@"",@"请输入店铺或公司名称",@"请输入联系人",@"请输入联系人电话",@"图片验证码",@"",@""];
        cell.titLab.text = array_phone[indexPath.row];
        cell.conTF.placeholder = phone_array[indexPath.row];
        cell.conTF.borderStyle = UITextBorderStyleNone;
        cell.leftBtn.hidden =YES;
        switch (indexPath.row) {
            case 0:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate = self;
                cell.conTF.tag  = 100;
            }
                break;
            case 1:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate  = self;
                cell.conTF.tag  = 101;
                cell.leftBtn.hidden =NO;
                [ cell.leftBtn setBackgroundImage:[UIImage imageNamed:@"VIEW---OFF"] forState:UIControlStateNormal];
                cell.leftBtn.tag =200;
                [ cell.leftBtn setBackgroundImage:[UIImage imageNamed:@"VIEW"] forState:UIControlStateSelected];
                [cell.leftBtn addTarget:self action:@selector(secure_MMBtnClick:) forControlEvents:UIControlEventTouchUpInside];
            }
                break;
            case 2:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate    = self;
                cell.conTF.tag     = 102;
                cell.leftBtn.hidden =NO;
                [ cell.leftBtn setBackgroundImage:[UIImage imageNamed:@"VIEW---OFF"] forState:UIControlStateNormal];
                cell.leftBtn.tag =201;
                [ cell.leftBtn setBackgroundImage:[UIImage imageNamed:@"VIEW"] forState:UIControlStateSelected];
                [cell.leftBtn addTarget:self action:@selector(secure_MMBtnClick:) forControlEvents:UIControlEventTouchUpInside];
            }
                break;
                case 3:
            {
                cell.conTF.hidden = YES;
                UIImageView *personalImage = [[UIImageView alloc]initWithFrame:CGRectMake(left,30, 10, 10)];
                personalImage.image = [UIImage imageNamed:@"1"];
                [cell.contentView addSubview:personalImage];
                UILabel *personalLabel = [[UILabel alloc]initWithFrame:CGRectMake(155, 25, 40, 20)];
                personalLabel.textAlignment = NSTextAlignmentLeft;
                personalLabel.font = [UIFont systemFontOfSize:13];
                personalLabel.textColor = [UIColor colorWithRed:0.71 green:0.72 blue:0.72 alpha:1.00];
                personalLabel.text = @"个人";
                [cell.contentView addSubview:personalLabel];
                
                UIButton *personalButton = [UIButton buttonWithType:UIButtonTypeCustom];
                [personalButton addTarget:self action:@selector(personalAndCompAction:) forControlEvents:UIControlEventTouchUpInside];
                personalButton.tag = 104;
                personalButton.frame = CGRectMake(140,25,60,20);
                [cell.contentView addSubview:personalButton];
                /*
                 企业
                 */
                UIImageView *corporateImage = [[UIImageView alloc]initWithFrame:CGRectMake(210,30, 10, 10)];
                corporateImage.image = [UIImage imageNamed:@"1"];
                [cell.contentView addSubview:corporateImage];
                
                UILabel *corporateLabel = [[UILabel alloc]initWithFrame:CGRectMake(225, 25, 45, 20)];
                corporateLabel.textAlignment = NSTextAlignmentLeft;
                corporateLabel.font = [UIFont systemFontOfSize:13];
                corporateLabel.textColor = [UIColor colorWithRed:0.71 green:0.72 blue:0.72 alpha:1.00];
                corporateLabel.text = @"企业";
                [cell.contentView addSubview:corporateLabel];
                
                UIButton *corporateButton = [UIButton buttonWithType:UIButtonTypeCustom];
                [corporateButton addTarget:self action:@selector(personalAndCompAction:) forControlEvents:UIControlEventTouchUpInside];
                corporateButton.tag = 105;
                corporateButton.frame = CGRectMake(210,25,60,20);
                [cell.contentView addSubview:corporateButton];
            }
            case 4:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate    = self;
                cell.conTF.tag     = 104;
            }
                break;
            case 5:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate    = self;
                cell.conTF.tag     = 105;
            }
                break;
            case 6:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate    = self;
                cell.conTF.tag     = 106;
            }
                break;
            case 7:
            {
                cell.conTF.hidden = YES;
                //验证码field
                UITextField *field_phoneYanzhengma = [[UITextField alloc]initWithFrame:CGRectMake(left, 20, 70, 30)];
                field_phoneYanzhengma.delegate = self;
                field_phoneYanzhengma.placeholder = @"图片验证码";
                field_phoneYanzhengma.font = [UIFont systemFontOfSize:13];
                [cell.contentView addSubview:field_yanzhengma];
                UIImageView *phoneYanzhengmaImage = [[UIImageView alloc]initWithFrame:CGRectMake(kScrernWidth-110, 20, 90, 35)];
                phoneYanzhengmaImage.image = [UIImage imageNamed:@"2"];
                [cell.contentView addSubview:phoneYanzhengmaImage];
            }
                break;
            case 8:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate = self;
                cell.conTF.tag  = 108;
            }
                break;
            case 9:
            {
                cell.conTF.text = @"";
                cell.conTF.delegate    = self;
                cell.conTF.tag     = 109;
            }
                break;
            default:
                break;
        }
        return cell;
          } else if (registerSegmentControl.selectedSegmentIndex == 1){
              static NSString *identifer=@"registerCell";
              UITableViewCell *MyCell=[tableView cellForRowAtIndexPath:indexPath];
              if (MyCell==nil) {
                  MyCell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifer];
              }
              MyCell.selectionStyle = UITableViewCellSelectionStyleNone;
              [registerTableView setSeparatorColor:[UIColor whiteColor]];
              NSLog(@"－－－邮箱注册");
              NSArray *array_email = @[@"邮箱地址:",@"密码:",@"确认密码:",@"商铺身份:",@"名称:",@" 服务人员姓名:",@" 服务人员电话:",@"验证码:",@"",@""];
              field_array = @[@"请输入邮箱地址",@"请输入6-20位字符",@"请输入6-20位字符",@"",@"请输入店铺或公司名称",@"",@"",@"",@""];
              
              UILabel *label_email = [[UILabel alloc]initWithFrame:CGRectMake(10, 20,110, 30)];
              label_email.text = [array_email objectAtIndex:indexPath.row];
              label_email.textAlignment = NSTextAlignmentRight;
              label_email.font = [UIFont systemFontOfSize:15];
              [MyCell addSubview:label_email];
              
              if ((indexPath.section == 0 && indexPath.row == 0) || indexPath.row == 1 || (indexPath.row == 2 || indexPath.row == 4 || indexPath.row == 5 || indexPath.row == 6 )) {
                  UITextField *field_email = [[UITextField alloc]initWithFrame:CGRectMake(135, 20, kScrernWidth-190, 30)];
                  field_email.tag = 168 + indexPath.section * 10 + indexPath.row;
                  field_email.delegate = self;
                  field_email.placeholder = [field_array objectAtIndex:indexPath.row];
                  field_email.font = [UIFont systemFontOfSize:13];
                  [MyCell addSubview:field_email];
                  
              }else if (indexPath.section == 0 && indexPath.row == 7){
                  //验证码field
                  field_yanzhengma = [[UITextField alloc]initWithFrame:CGRectMake(left, 20, 70, 30)];
                  field_yanzhengma.delegate = self;
                  field_yanzhengma.placeholder = @"图片验证码";
                  field_yanzhengma.font = [UIFont systemFontOfSize:13];
                  [MyCell addSubview:field_yanzhengma];
                  
                  UIImageView *yanzhengmaImage = [[UIImageView alloc]initWithFrame:CGRectMake(kScrernWidth-110, 18, 90, 35)];
                  yanzhengmaImage.image = [UIImage imageNamed:@"2"];
                  [MyCell addSubview:yanzhengmaImage];
              }else if (indexPath.section == 0 && indexPath.row == 3){
                  /*
                   个人
                   */
                  UIImageView *personalImage = [[UIImageView alloc]initWithFrame:CGRectMake(left,30, 10, 10)];
                  personalImage.image = [UIImage imageNamed:@"1"];
                  [MyCell addSubview:personalImage];
                  
                  UILabel *personalLabel = [[UILabel alloc]initWithFrame:CGRectMake(155, 25, 40, 20)];
                  personalLabel.textAlignment = NSTextAlignmentLeft;
                  personalLabel.font = [UIFont systemFontOfSize:13];
                  personalLabel.textColor = [UIColor colorWithRed:0.71 green:0.72 blue:0.72 alpha:1.00];
                  personalLabel.text = @"个人";
                  [MyCell addSubview:personalLabel];
                  
                  UIButton *personalButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  [personalButton addTarget:self action:@selector(personalAndCorporateButtonAction:) forControlEvents:UIControlEventTouchUpInside];
                  personalButton.tag = 504;
                  personalButton.frame = CGRectMake(140,25,60,20);
                  [MyCell addSubview:personalButton];
                  
                  /*
                   企业
                   */
                  UIImageView *corporateImage = [[UIImageView alloc]initWithFrame:CGRectMake(210,30, 10, 10)];
                  corporateImage.image = [UIImage imageNamed:@"1"];
                  [MyCell addSubview:corporateImage];
                  
                  UILabel *corporateLabel = [[UILabel alloc]initWithFrame:CGRectMake(225, 25, 45, 20)];
                  corporateLabel.textAlignment = NSTextAlignmentLeft;
                  corporateLabel.font = [UIFont systemFontOfSize:13];
                  corporateLabel.textColor = [UIColor colorWithRed:0.71 green:0.72 blue:0.72 alpha:1.00];
                  corporateLabel.text = @"企业";
                  [MyCell addSubview:corporateLabel];
                  
                  UIButton *corporateButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  [corporateButton addTarget:self action:@selector(personalAndCorporateButtonAction:) forControlEvents:UIControlEventTouchUpInside];
                  corporateButton.tag = 505;
                  corporateButton.frame = CGRectMake(210,25,60,20);
                  [MyCell addSubview:corporateButton];
              }
              
              if ((indexPath.section == 0 && indexPath.row == 0) || indexPath.row == 1 || (indexPath.row == 2 || indexPath.row == 3 || indexPath.row == 4 || indexPath.row == 5 || indexPath.row == 6 || indexPath.row == 7)) {
                  UIView *registerView = [[UIView alloc]initWithFrame:CGRectMake(10,69, kScrernWidth-10, 1)];
                  registerView.backgroundColor = [UIColor colorWithRed:0.89 green:0.89 blue:0.89 alpha:1.00];
                  [MyCell addSubview:registerView];
              }
              if (indexPath.section == 0 && indexPath.row == 8) {
                  UIButton *register_button = [UIButton buttonWithType:UIButtonTypeCustom];
                  [register_button addTarget:self action:@selector(registerButtonkAction:) forControlEvents:UIControlEventTouchUpInside];
                  [register_button setTitle:@"注册" forState:UIControlStateNormal];
                  register_button.tag = 456;
                  register_button.layer.masksToBounds = YES;
                  register_button.layer.cornerRadius = 5;
                  register_button.frame = CGRectMake(10,25,kScrernWidth-20,35);
                  register_button.backgroundColor = [UIColor colorWithRed:0.98 green:0.32 blue:0.12 alpha:1.00];
                  [MyCell addSubview:register_button];
              } else if (indexPath.section == 0 && indexPath.row == 9){
                  UIButton *agreement_button = [UIButton buttonWithType:UIButtonTypeCustom];
                  [agreement_button addTarget:self action:@selector(registerButtonkAction:) forControlEvents:UIControlEventTouchUpInside];
                  agreement_button.titleLabel.textAlignment = NSTextAlignmentCenter;
                  agreement_button.titleLabel.font = [UIFont systemFontOfSize:14];
                  agreement_button.tag = 457;
                  [agreement_button setTitle:@"“注册” 即接受《益购使用协议》" forState:UIControlStateNormal];
                  agreement_button.frame = CGRectMake(registerTableView.center.x - 90 ,0,200,30);
                  [agreement_button setTitleColor:[UIColor colorWithRed:0.98 green:0.32 blue:0.12 alpha:1.00] forState:UIControlStateNormal];
                  [MyCell addSubview:agreement_button];
                  
                  UILabel *signIn_label = [[UILabel alloc]initWithFrame:CGRectMake(agreement_button.center.x - 75,30, 120, 30)];
                  signIn_label.font = [UIFont systemFontOfSize:14];
                  signIn_label.textColor = [UIColor colorWithRed:0.68 green:0.68 blue:0.68 alpha:1.00];
                  signIn_label.text = @"已注册过益购?点击";
                  [MyCell addSubview:signIn_label];
                  
                  UIButton *signIn_button = [UIButton buttonWithType:UIButtonTypeCustom];
                  [signIn_button addTarget:self action:@selector(signInButtonkAction) forControlEvents:UIControlEventTouchUpInside];
                  signIn_button.titleLabel.font = [UIFont systemFontOfSize:14];
                  [signIn_button setTitle:@"登录" forState:UIControlStateNormal];
                  signIn_button.frame = CGRectMake(agreement_button.center.x + 45 ,30,40,30);
                  [signIn_button setTitleColor:[UIColor colorWithRed:0.98 green:0.32 blue:0.12 alpha:1.00] forState:UIControlStateNormal];
                  [MyCell addSubview:signIn_button];
              }else if ((indexPath.section == 0 && indexPath.row == 1)){
                  passwordButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  passwordButton.frame = CGRectMake(kScrernWidth-50,25,30,20);
                  passwordButton.tag = 588;
                  [passwordButton addTarget:self action:@selector(passwordButtonAction:) forControlEvents:UIControlEventTouchUpInside];
                  [passwordButton setImage:[UIImage imageNamed:@"VIEW"] forState:UIControlStateNormal];
                  [MyCell addSubview:passwordButton];
              }else if ((indexPath.section == 0 && indexPath.row == 2)){
                  confirmPasswordButton = [UIButton buttonWithType:UIButtonTypeCustom];
                  confirmPasswordButton.frame = CGRectMake(kScrernWidth-50,25,30,20);
                  [confirmPasswordButton addTarget:self action:@selector(passwordButtonAction:) forControlEvents:UIControlEventTouchUpInside];
                  [confirmPasswordButton setImage:[UIImage imageNamed:@"VIEW"] forState:UIControlStateNormal];
                  confirmPasswordButton.tag = 589;
                  [MyCell addSubview:confirmPasswordButton];
                  
              }
              return MyCell;

        }
    return nil;
}
#pragma mark --  接受注册协议
- (void)registerButtonkAction{
    NSLog(@"益购使用协议");
}
- (void)signInButtonkAction{
    NSLog(@"跳转登陆");
}

-(void)secure_MMBtnClick:(UIButton *)sender
{

    NSLog(@"%ld",(long)sender.tag);
    if (sender.tag ==200) {
        if (sender.selected==YES) {
            sender.selected = NO;
            //        self.password.secureTextEntry = YES;
        }
        else if (sender.selected==NO) {
            sender.selected = YES;
            //        self.password.secureTextEntry = NO;
            
        }
        
    }else if (sender.tag ==201){
        if (sender.selected==YES) {
            sender.selected = NO;
            //        self.password.secureTextEntry = YES;
        }
        else if (sender.selected==NO) {
            sender.selected = YES;
            //        self.password.secureTextEntry = NO;
            
        }
        
    }
    
}
#pragma mark -- 个人 or 企业
-(void)personalAndCompAction:(UIButton *)sender{
    switch (sender.tag) {
        case 104:{
            NSLog(@"____个人");
        }
            break;
        case 105:{
            NSLog(@"____企业");
        }
            break;
            
        default:
            break;
    }
}

- (void)personalAndCorporateButtonAction:(UIButton *)sender{
    switch (sender.tag) {
        case 504:{
            NSLog(@"个人");
        }
            break;
        case 505:{
            NSLog(@"企业");
        }
            break;
        case 198:{
            NSLog(@"手机个人");
        }
            break;
        case 199:{
            NSLog(@"手机企业");
        }
            break;
            
        default:
            break;
    }
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}
#pragma textfiledDelagate
- (void)textFieldDidEndEditing:(UITextField *)textField{
    switch (textField.tag) {
        case 100:{
            //name
//            self.nameStr = textField.text;
            
        }break;
        case 101:{
            //手机
//            self.telephoneStr = textField.text;
            
        }break;

        case 102:{
            //租金
//            self.rentStr  = textField.text;
            
        }break;
            
        default:
            break;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
